package com.example.carkey;

public class FastClickUtil {

    // 两次点击按钮之间的间隔不能少于500毫秒
    private static final int MIN_CLICK_DELAY_TIME = 500;
    private static long lastClickTIme;

    private static long lastHandleTime;
    private static final int ONE_SECOND_DELAY_TIME = 1000;

    public static boolean isFastClick() {
        long curClickTime = System.currentTimeMillis();
        if (Math.abs(curClickTime - lastClickTIme) < MIN_CLICK_DELAY_TIME) return true;
        lastClickTIme = curClickTime;
        return false;
    }

    public static boolean exceedOneSecond() {
        long curClickTime = System.currentTimeMillis();
        if (Math.abs(curClickTime - lastClickTIme) < ONE_SECOND_DELAY_TIME) return true;
        lastHandleTime = curClickTime;
        return false;
    }

}
